
export const request =  (params)=>{

    // console.log(params.url);
    //默认Base路径
    const  baseUrl = "https://www.fulfill.com.cn/api/v1";
    // const  baseUrl = "http://127.0.0.1:9898/api/v1";

    //加载loading
    wx.showLoading({
        title: "加载中",
        mask: true,
    });
      

    return new Promise((resolve,reject)=>{
        wx.request({
           
            ...params,
            url: baseUrl+params.url ,
            fail:(err)=>{
                reject(err);    
            },
            success: (res) => {
                let result = res.data;
                if(result.meta.code === 200){
                    let data = result.message;
                    resolve(data);
                }else{
                    console.log(result)
                    wx.showToast({
                      title: result.meta.msg,
                      icon:'none'
                    })
                }
            },
            complete:()=>{
                //取消loading
                wx.hideLoading();
            }
        });
    })


}



